package com.uzai.console.web.sop;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.BaseDto;
import com.uzai.console.dto.sop.sopprirewardrule.SopPriRewardRuleDto;
import com.uzai.console.dto.sop.sopprirewardrule.SopPriRewardRuleIdDto;
import com.uzai.console.dto.sop.sopprirewardrule.SopPriRewardRuleQuery;
import com.uzai.console.dto.sop.sopprirewardrule.SopPriRewardRuleSendParaDto;
import com.uzai.console.service.sop.SopPriRewardRuleService;
import com.uzai.console.vo.sop.sopprirewardrule.SopPriRewardRuleSendParaVo;
import com.uzai.console.vo.sop.sopprirewardrule.SopPriRewardRuleVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * SOP定向规则
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "SOP定向规则",tags = "SOP任务|SOP定向规则")
@ApiSort(31)
@RestController
public class SopPriRewardRuleController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(SopPriRewardRuleController.class);

    @Autowired
    private SopPriRewardRuleService sopPriRewardRuleService;

    @ApiOperation(value = "分页查询SOP定向规则列表", notes = "分页查询SOP定向规则列表", response = SopPriRewardRuleVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/sopPriRewardRule/findByPage")
    public Object findSopPriRewardRulePage(@RequestBody SopPriRewardRuleQuery sopPriRewardRuleQuery){
        return sopPriRewardRuleService.findByPage(sopPriRewardRuleQuery);
    }

    @ApiOperation(value = "查询SOP定向规则详情", notes = "查询SOP定向规则详情", response = SopPriRewardRuleVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/sopPriRewardRule/findById")
    public Object findSopPriRewardRule(@RequestBody SopPriRewardRuleIdDto sopPriRewardRuleIdDto){
        return sopPriRewardRuleService.findById(sopPriRewardRuleIdDto);
    }

    @ApiOperation(value = "修改SOP定向规则", notes = "修改SOP定向规则")
    @ApiOperationSupport(order = 4)
    @PostMapping("/sopPriRewardRule/update")
    public Object updateSopPriRewardRule(@RequestBody SopPriRewardRuleDto sopPriRewardRuleDto){
        sopPriRewardRuleService.updateSopPriRewardRule(sopPriRewardRuleDto);
        return true;
    }

    @ApiOperation(value = "SOP定向规则设置发送参数", notes = "SOP定向规则设置发送参数")
    @ApiOperationSupport(order = 5)
    @PostMapping("/sopPriRewardRule/SendPara/update")
    public Object updateSendPara(@RequestBody SopPriRewardRuleSendParaDto sopPriRewardRuleSendParaDto){
        sopPriRewardRuleService.updateSendPara(sopPriRewardRuleSendParaDto);
        return true;
    }

    @ApiOperation(value = "SOP定向规则查询发送参数", notes = "SOP定向规则设置发送参数", response = SopPriRewardRuleSendParaVo.class)
    @ApiOperationSupport(order = 6)
    @PostMapping("/sopPriRewardRule/SendPara/find")
    public Object findSendPara(@RequestBody BaseDto baseDto){
        return sopPriRewardRuleService.findSendPara(baseDto);
    }

}
